﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DungeonAndDragonApplication.Controller.Game.UserInformation;
using DungeonAndDragonApplication.Controller.Commands;
using DungeonAndDragonApplication.Model;
using ADNDNetwork;

namespace DungeonAndDragonApplication.Controller
{
    /// <summary>
    /// This class while host the functions the user 
    /// clicked in the interface.
    /// </summary>
    /// <example>
    /// User selects to add a friend, then this class will handle the requested action
    /// </example>
    public class ControllerManager
    {
        #region DELEGATES

        
        public delegate void receivedMessageDelegate(AdndMessage message);

        #endregion

        #region EVENTS

        public event receivedMessageDelegate receivedMessage_Event;

        #endregion


        private ModelManager mm;

        public ControllerManager(ModelManager modelManager)
        {
            mm = modelManager;
        }

        public void UserStartsGame( UserType ut )
        {
            StartGame sg = new StartGame(ut);
            sg.execute();
        }

        /// <summary>
        /// Send message....
        /// </summary>
        /// <param name="message"></param>
        public void SendMessage(string message)
        {
            SendMessage sm = new SendMessage(message);
            sm.execute();
        }

        public void SendMessage(AdndMessage message)
        {
            SendMessage sm = new SendMessage(message);
            sm.execute(message);
        }


        public string ReceiveMessage(string receivedMessage)
        {
            //receivedMessage_Event(receivedMessage);

            System.Console.WriteLine(receivedMessage.ToString());
            return receivedMessage;
        }

        public string getAboutInformation()
        {
            return "This is an app to play D&D";
        }
    }
}
